package cn.zyjblogs.config.replay;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 防重放攻击
 *
 * @author zhuyijun
 */
@Data
@ConfigurationProperties(prefix = "zyjblogs.anti.replay")
public class AntiReplayProperties {
    public static final String REDIS_PREFIX = "anti:replay:";
    /**
     * 是否启用防重放验证
     */
    private Boolean enabled = false;

    private Boolean signEnabled = false;

    /**
     * 请求ID 防止重放
     */
    private String nonce = "requestId";
    /**
     * 请求时间 避免缓存时间过后重放
     */
    private String timestamp = "timestamp";

    private String sign = "sign";

    private String key = "x-ca-key";

    private String signMethod = "x-ca-signature-method";
    private String signHeaders = "X-Ca-Signature-Headers";

    private Long expireTime = 120L;

}
